﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Threading;
using System.Globalization;


public sealed class MyCulture {

    public static void SetCulture() {

        String selectedLanguage = ConfigurationManager.AppSettings["DefaultCulture"].ToString();

        if (HttpContext.Current.Session["culture"] != null)
            selectedLanguage = HttpContext.Current.Session["culture"].ToString();

        Thread.CurrentThread.CurrentCulture =
            CultureInfo.CreateSpecificCulture(selectedLanguage);
        Thread.CurrentThread.CurrentUICulture = new
            CultureInfo(selectedLanguage);
    }

    public static void ChangeCulture(string culture) {
        HttpContext.Current.Session["culture"] = culture;
    }
}
